Programming 529

CodeConvert 소개

google에서 convert go to rust 라고 치면 맨 위에 나오는 사이트이다. URL: Free Code Converter CodeConvert AI - Convert code with a click of a button Convert from ActionScript www.codeconvert.ai AI를 이용해서 프로그램 소스 코드를 다른 프로그래밍 언어로 변환해준다. 지원하는 언어는 C, C++, Common Lisp, Go, Rust, Racket, Java 등 다양하다. 예제로 MNIST를 Go에서 Rust로 변환해봤는데, csv 파일 읽는 공통 부분을 함수로 빼냈다! 대단하다. let (answer, data) = (&line[0], &line[1..]); 부분도 원래 없는 answ..

Programming 2024.04.20

(Julia) 매크로

Julia에서는 Lisp의 매크로와 비슷하게 매크로를 사용할 수 있다. Metaprogramming · The Julia Language :()로 quote하고, $로 unquote한다. 예제: julia> :($1+1) :(1 + 1) julia> :($(1+1)) 2 julia> macro aif(a,b,c) :(if $a; $b else $c end) end @aif (macro with 1 method) julia> @aif 1 2 3 ERROR: TypeError: non-boolean (Int64) used in boolean context Stacktrace: [1] top-level scope @ REPL[6]:1 julia> @macroexpand @aif 1 2 3 :(if 1 #= R..

Programming 2024.01.26

백만 이하로 시작하는 우박수 중 가장 긴 과정을 거치는 것은?

백만 이하로 시작하는 우박수 중 가장 긴 과정을 거치는 것은? (tistory.com) 백만 이하로 시작하는 우박수 중 가장 긴 과정을 거치는 것은? 사이트 이름 - 문제 14번 백만 이하로 시작하는 우박수 중 가장 긴 과정을 거치는 것은? 양의 정수 n에 대하여, 다음과 같은 계산 과정을 반복하기로 합니다. n → n / 2 (n이 짝수일 때) n → 3 * n + 1 ( thisblogbusy.tistory.com Common Lisp: (let ((hh (make-hash-table))) (defun hailstone (n) (if (= n 1) (return-from hailstone 1)) (let ((h (gethash n hh))) (if h h (setf (gethash n hh) (1+ ..

Programming 2024.01.09